//
//  CSSManager.m
//  CToolBox
//
//  Created by SC on 16/12/14.
//  Copyright © 2016年 SC. All rights reserved.
//

#import "CSSManager.h"


@implementation CSSManager

+ (CSSManager *)shareManagerInstance
{
    static CSSManager *manager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        manager = [[CSSManager alloc] init];
    });
    return manager;
}
// 登陆
+ (AuthOperator *)getAuthOperator
{
    static AuthOperator *operator = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        operator = [[AuthOperator alloc] init];
        operator.delegate = [CSSManager shareManagerInstance];
    });
    return operator;
}
// 装车
+ (PackingOperator *)getPackingOperator
{
    static PackingOperator *operator = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        operator = [[PackingOperator alloc] init];
        operator.delegate = [CSSManager shareManagerInstance];
    });
    return operator;
}
// 查询
+ (QueryOperator *)getQueryOperator
{
    static QueryOperator *operator = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        operator = [[QueryOperator alloc] init];
        operator.delegate = [CSSManager shareManagerInstance];
    });
    return operator;
}


#pragma mark - CTOperatorDelegate

- (void)operatorRequestEnd
{
    if ([_delegate respondsToSelector:@selector(operatorManagerRequestEnd)]) {
        [_delegate operatorManagerRequestEnd];
    }
}

- (void)operatorExistErrorWithNo:(int)ErrorNo Message:(NSString *)ErrorMessage
{
    if ([_delegate respondsToSelector:@selector(operatorManagerExistErrorWithNo:Message:)]) {
        [_delegate operatorManagerExistErrorWithNo:ErrorNo Message:ErrorMessage];
    }
}

- (void)operatorRequestFailure
{
    if ([_delegate respondsToSelector:@selector(operatorManagerRequestFailure)]) {
        [_delegate operatorManagerRequestFailure];
    }
}

@end
